package top.lyunk.java.date;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

public class 新时间类 {
    public static void main(String[] args) {
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

        ZonedDateTime now = ZonedDateTime.now();
        System.out.println(now);
        System.out.println(now.getZone());
        System.out.println(ZoneId.SHORT_IDS.get("CTT"));
        System.out.println(ZoneId.of("Asia/Shanghai"));
        System.out.println(now.format(dateTimeFormatter));
        System.out.println("==========================================");

        LocalDateTime localDateTimeNow = LocalDateTime.now();
        System.out.println(localDateTimeNow);
        System.out.println(localDateTimeNow.format(dateTimeFormatter));
    }
}
